package com.lphl.pet;

import com.lphl.pet.activity.FirstActivity;
import com.lphl.pet.util.DialogUtil;

import android.os.Bundle;
import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.util.DisplayMetrics;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity implements OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        DisplayMetrics metrics=new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(metrics);
        GloableParams.winWidth=metrics.widthPixels;

        initView();
    }

    private void initView() {
        TextView tv_tradeedition = (TextView) findViewById(R.id.tv_tradeedition);
        TextView tv_ultimate = (TextView) findViewById(R.id.tv_ultimate);
        Button bind = (Button) findViewById(R.id.bind);
        Button buy = (Button) findViewById(R.id.buy);
        tv_tradeedition.setOnClickListener(this);
        tv_ultimate.setOnClickListener(this);
        bind.setOnClickListener(this);
        buy.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_tradeedition: // 普及版
                Toast.makeText(this, "普及版", Toast.LENGTH_LONG).show();
                DialogUtil.getInstance().showTradeeditionDialog(this);
                break;
            case R.id.tv_ultimate: // 旗舰版
                Toast.makeText(this, "旗舰版", Toast.LENGTH_LONG).show();
                DialogUtil.getInstance().showUltimateDialog(this);
                break;
            case R.id.bind:
                Intent intent = new Intent(this, FirstActivity.class);
                startActivity(intent);
                break;
            case R.id.buy:

                break;
            default:
                break;
        }
    }
}
